package org.demo.szml.api.rpc;

import org.demo.szml.api.dto.PermissionBindingReqDTO;
import org.demo.szml.api.dto.PermissionBindingResDTO;
import org.demo.szml.api.dto.PermissionUserAttributionResDTO;
import org.demo.szml.api.response.Response;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @description: 权限服务接口
 * @date: 2025/6/15 22:38
 * @version: 1.0
 */
public interface IPermissionRPCService {

    /** 给定用户Id，绑定默认角色
     * @param userId 用户Id
     * @return 绑定结果
     */
    @PostMapping("/role/binding")
    Response<PermissionBindingResDTO> bindDefaultRole(@RequestParam("userId") Long userId);

    /** 获取用户授权信息
     * @param operatorId 操作者ID
     * @param page 页码
     * @param size 每页数量
     * @return 用户授权信息
     */
    @GetMapping("/auth/users")
    Response<PermissionUserAttributionResDTO> authAttributeUsers(@RequestParam("operatorId") Long operatorId,
                                                        @RequestParam("page") Integer page,
                                                        @RequestParam("size") Integer size);

    /** 获取用户授权信息 验证对指定用户id的权限信息
     * @param operatorId 操作者ID
     * @param userId 用户ID
     * @return 用户授权信息
     */
    @GetMapping("/auth/user")
    Response<PermissionUserAttributionResDTO> authAttributeUser(@RequestParam("operatorId") Long operatorId,
                                                        @RequestParam("userId") Long userId);

    /** 重新绑定角色信息
     * @param userId 用户ID
     * @param operatorId 操作者ID
     * @param roleId 角色ID
     * @return 重新绑定结果
     */
    @PostMapping("/role/rebinding")
    Response<PermissionBindingResDTO> rebindRole(@RequestParam("userId") Long userId,
                                                 @RequestParam("operatorId") Long operatorId,
                                                 @RequestParam("roleId") Integer roleId);
}
